import request from '@/utils/request'

export function fetchList(query) {
  return request({
    url: '/api/distributor/list',
    method: 'get',
    params: query
  })
}

export function fetchSettleList(query) {
  return request({
    url: '/api/distributor-settle/list',
    method: 'get',
    params: query
  })
}

export function fetchDistributor(id) {
  return request({
    url: '/api/distributor/detail',
    method: 'get',
    params: { id }
  })
}

export function fetchDistributorUser(query) {
  return request({
    url: '/api/distributor/query-users',
    method: 'get',
    params: query
  })
}

export function createDistributor(data) {
  return request({
    url: '/api/distributor/create',
    method: 'post',
    data
  })
}

export function updateDistributor(data) {
  return request({
    url: '/api/distributor/update',
    method: 'post',
    data
  })
}

export function updateDistributorSettle(data) {
  return request({
    url: '/api/distributor-settle/update',
    method: 'post',
    data
  })
}

export function deleteDistributor(id) {
  return request({
    url: '/api/distributor/delete/' + id,
    method: 'post'
  })
}
